package com.lws.basic.utils.common;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lws.basic.view.adapter.AdapterIntegerDefault0;
import com.lws.basic.view.adapter.DoubleDefault0Adapter;

/**
 * @松 on 2019/12/24 09:24
 */
public class GsonUtils {
    private static Gson gson;
    public static Gson getInstance(){
        if (gson == null) {
            synchronized (GsonUtils.class) {
                if (gson == null) {
                    gson =new GsonBuilder()
                            .registerTypeAdapter(Integer.class, new AdapterIntegerDefault0())
                            .registerTypeAdapter(int.class, new AdapterIntegerDefault0())
                            .registerTypeAdapter(Double.class, new DoubleDefault0Adapter())
                            .registerTypeAdapter(double.class, new DoubleDefault0Adapter())
                            .create();
                }
            }
        }
        return gson;
    }
   /* public static Gson buildGson() {
        return
    }*/

}
